package com.recovery.flash.components
{
	import camo.core.display.CamoDisplay;  
      
    import flash.text.TextField;  
  
    public class LabelComponent extends CamoDisplay  
    {  
          
        protected static const FIRST_WORD:String = "Hello";  
        protected var words:Array = new Array("World", "People", "Flash", "Flash Tuts");   
        protected var label:TextField;  
          
        /** 
         *  
         * @return Total number of words. 
         *  
         */       
        public function get totalWords():Number  
        {  
            return words.length;  
        }  
          
        /** 
         * Class Constructor. 
         *  
         *
         *           */       
        public function LabelComponent()  
        {  
            super();  
            init();  
        }  
          
        /** 
         * Class init function 
         *  
         */       
        protected function init():void  
        {  
            label = createTextField();  
            addChild(label);  
        }  
          
        /** 
         *  
         * @return TextField for displaying a message on. 
         *  
         */       
        protected function createTextField():TextField  
        {  
            var tempTextField:TextField = new TextField();  
                tempTextField.selectable = false;  
                  
            return tempTextField;  
        }  
          
        /** 
         * Changes a word based on an ID. 
         * @param id index related to the words Array. 
         *  
         */       
        public function changeWords(id:Number):void  
        {  
            label.text = FIRST_WORD + " " + words[id];  
        }  
  
    }  

}